<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
                    xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters;assembly=MaterialDesignThemes.Wpf"
                    xmlns:globalization="clr-namespace:System.Globalization;assembly=mscorlib">

  <Style x:Key="MaterialDesignCalendarButton" TargetType="{x:Type CalendarButton}">
    <Setter Property="MinWidth" Value="5"/>
    <Setter Property="MinHeight" Value="5"/>
    <Setter Property="FontSize" Value="12"/>
    <Setter Property="Cursor" Value="Hand"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="Margin" Value="2"/>
    <Setter Property="Width" Value="48" />
    <Setter Property="Height" Value="48" />
    <Setter Property="HorizontalContentAlignment" Value="Center"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type CalendarButton}">
          <Grid>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0:0:0.1"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="MouseOver">
                  <Storyboard>
                    <DoubleAnimation Duration="0" To="0.16" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightBackground"/>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Pressed">
                  <Storyboard>
                    <DoubleAnimation Duration="0" To="0.4" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightBackground"/>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightBackground"/>
                    <DoubleAnimation Duration="0" To=".35" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="NormalText"/>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="SelectionStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Unselected"/>
                <VisualState x:Name="Selected">
                  <Storyboard>
                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectedBackground"/>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground)" Storyboard.TargetName="NormalText">
                      <DiscreteObjectKeyFrame Value="{DynamicResource PrimaryHueMidForegroundBrush}" KeyTime="0" />
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="CalendarButtonFocusStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="CalendarButtonFocused">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DayButtonFocusVisual">
                      <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                          <Visibility>Visible</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                      </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="CalendarButtonUnfocused">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DayButtonFocusVisual">
                      <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                          <Visibility>Collapsed</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                      </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="ActiveStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Active"/>
                <VisualState x:Name="Inactive" />
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Ellipse x:Name="TodayBackground"
                     Fill="{DynamicResource PrimaryHueLightBrush}"
                     Opacity="0" />
            <Ellipse x:Name="SelectedBackground"
                     Fill="{DynamicResource PrimaryHueMidLightBrush}"
                     Opacity="0" />
            <Border BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Background="{TemplateBinding Background}" />
            <Ellipse x:Name="HighlightBackground"
                     Fill="{DynamicResource HighContrastPrimaryBrush}"
                     Opacity="0" />
            <ContentPresenter x:Name="NormalText"
                              TextElement.Foreground="{TemplateBinding Foreground}"
                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                              Margin="5,1,5,1"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
            <Ellipse x:Name="DayButtonFocusVisual"
                     Stroke="{DynamicResource PrimaryHueDarkBrush}"
                     Opacity="0"
                     Visibility="Collapsed"
                     StrokeThickness="1" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="IsInactive"
               Value="True">
        <Setter Property="MinHeight"
                Value="0" />
        <Setter Property="MaxHeight"
                Value="0" />
      </Trigger>
    </Style.Triggers>
  </Style>

  <Style x:Key="MaterialDesignCalendarDayButton" TargetType="{x:Type CalendarDayButton}">
    <Setter Property="Foreground" Value="{DynamicResource MaterialDesignBody}"/>
    <Setter Property="MinWidth" Value="5"/>
    <Setter Property="MinHeight" Value="5"/>
    <Setter Property="FontSize" Value="12"/>
    <Setter Property="Cursor" Value="Hand" />
    <Setter Property="Margin" Value="2"/>
    <Setter Property="Width" Value="34" />
    <Setter Property="Height" Value="34" />
    <Setter Property="HorizontalContentAlignment" Value="Center"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type CalendarDayButton}">
          <Grid>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0:0:0.1"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="MouseOver">
                  <Storyboard>
                    <DoubleAnimation Duration="0" To="0.16" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightBackground"/>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Pressed">
                  <Storyboard>
                    <DoubleAnimation Duration="0" To="0.4" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightBackground"/>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="SelectionStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Unselected"/>
                <VisualState x:Name="Selected">
                  <Storyboard>
                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectedBackground"/>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground)" Storyboard.TargetName="NormalText">
                      <DiscreteObjectKeyFrame Value="{DynamicResource PrimaryHueMidForegroundBrush}" KeyTime="0" />
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="CalendarButtonFocusStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="CalendarButtonFocused">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DayButtonFocusVisual">
                      <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                          <Visibility>Visible</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                      </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="CalendarButtonUnfocused">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DayButtonFocusVisual">
                      <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                          <Visibility>Collapsed</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                      </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="ActiveStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Active"/>
                <VisualState x:Name="Inactive"/>
              </VisualStateGroup>
              <VisualStateGroup x:Name="DayStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="RegularDay"/>
                <VisualState x:Name="Today">
                  <Storyboard>
                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="TodayBackground"/>
                    <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground)" Storyboard.TargetName="NormalText">
                      <DiscreteObjectKeyFrame Value="{DynamicResource PrimaryHueLightForegroundBrush}" KeyTime="0" />
                    </ObjectAnimationUsingKeyFrames>-->
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="BlackoutDayStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition GeneratedDuration="0"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="NormalDay"/>
                <VisualState x:Name="BlackoutDay">
                  <Storyboard>
                    <DoubleAnimation Duration="0"
                                     To="0"
                                     Storyboard.TargetProperty="Opacity"
                                     Storyboard.TargetName="HighlightingBorder"/>
                    <DoubleAnimation Duration="0"
                                     To="0.38"
                                     Storyboard.TargetProperty="Opacity"
                                     Storyboard.TargetName="NormalText" />
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Ellipse x:Name="SelectedBackground"
                     Fill="{DynamicResource PrimaryHueMidLightBrush}"
                     Opacity="0" />
            <Border BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Background="{TemplateBinding Background}"/>
            <Ellipse x:Name="TodayBackground"
                     Stroke="{DynamicResource PrimaryHueLightBrush}"
                     StrokeThickness="1"
                     Opacity="0" />
            <Border x:Name="HighlightingBorder"
                    Opacity="1">
              <Ellipse x:Name="HighlightBackground"
                       Fill="{DynamicResource HighContrastPrimaryBrush}"
                       Opacity="0"/>
            </Border>
            <ContentPresenter x:Name="NormalText"
                              TextElement.Foreground="{TemplateBinding Foreground}"
                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                              Margin="5,1,5,1"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
            <Ellipse x:Name="DayButtonFocusVisual"
                     Stroke="{DynamicResource PrimaryHueDarkBrush}"
                     Opacity="0"
                     Visibility="Collapsed"
                     StrokeThickness="1"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsSelected" Value="True">
              <Setter Property="Fill" TargetName="HighlightBackground" Value="{DynamicResource PrimaryHueMidLightForegroundBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="IsInactive"
               Value="True">
        <Setter Property="MinHeight"
                Value="0" />
        <Setter Property="MaxHeight"
                Value="0" />
      </Trigger>
      <Trigger Property="IsBlackedOut"
               Value="True">
        <Setter Property="Cursor"
                Value="No" />
      </Trigger>
    </Style.Triggers>
  </Style>

  <Style x:Key="MaterialDesignCalendarItemPortrait" TargetType="{x:Type CalendarItem}">
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="Margin" Value="0,3,0,3"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type CalendarItem}">
          <ControlTemplate.Resources>
            <SineEase x:Key="EasingFunction" EasingMode="EaseOut"/>
            <CubicEase x:Key="EasingFunctionIn" EasingMode="EaseIn"/>

            <DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}">
              <TextBlock Foreground="{DynamicResource MaterialDesignBodyLight}"
                         Opacity="0.65"
                         FontWeight="Bold"
                         FontSize="9.5"
                         HorizontalAlignment="Center" VerticalAlignment="Center"
                         Margin="0,6,0,6"
                         Text="{Binding [0]}"/>
            </DataTemplate>
          </ControlTemplate.Resources>
          <Grid x:Name="PART_Root">
            <Grid.Resources>
              <SolidColorBrush x:Key="DisabledColor" Color="#A5FFFFFF"/>
            </Grid.Resources>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_DisabledVisual"/>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <wpf:Card Background="{TemplateBinding Background}" Margin="4">
              <Grid>
                <Grid.Resources>
                  <ControlTemplate x:Key="PreviousButtonTemplate" TargetType="{x:Type Button}">
                    <Grid Cursor="Hand">
                      <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                          <VisualState x:Name="Normal"/>
                          <VisualState x:Name="MouseOver" />
                          <VisualState x:Name="Disabled">
                            <Storyboard>
                              <DoubleAnimation Duration="0" To=".56" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="path"/>
                            </Storyboard>
                          </VisualState>
                        </VisualStateGroup>
                      </VisualStateManager.VisualStateGroups>
                      <wpf:Ripple HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Viewbox Height="12" Margin="8">
                          <Path x:Name="path" Data="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z" Fill="{TemplateBinding Foreground}" Stretch="Fill" />
                        </Viewbox>
                      </wpf:Ripple>
                    </Grid>
                  </ControlTemplate>
                  <ControlTemplate x:Key="NextButtonTemplate" TargetType="{x:Type Button}">
                    <Grid Cursor="Hand">
                      <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                          <VisualState x:Name="Normal"/>
                          <VisualState x:Name="MouseOver"/>
                          <VisualState x:Name="Disabled">
                            <Storyboard>
                              <DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="path"/>
                            </Storyboard>
                          </VisualState>
                        </VisualStateGroup>
                      </VisualStateManager.VisualStateGroups>
                      <wpf:Ripple HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Viewbox Height="12" Margin="8">
                          <Path x:Name="path" Data="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" Fill="{TemplateBinding Foreground}" Stretch="Fill"  />
                        </Viewbox>
                      </wpf:Ripple>
                    </Grid>
                  </ControlTemplate>
                  <ControlTemplate x:Key="HeaderButtonTemplate" TargetType="{x:Type Button}">
                    <Grid Cursor="Hand">
                      <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                          <VisualState x:Name="Normal"/>
                          <VisualState x:Name="MouseOver" />
                          <VisualState x:Name="Disabled"/>
                        </VisualStateGroup>
                      </VisualStateManager.VisualStateGroups>
                      <wpf:MaterialDateDisplay x:Name="buttonContent" Foreground="{DynamicResource PrimaryHueMidForegroundBrush}"
                                               IsEnabled="{TemplateBinding IsEnabled}">
                        <wpf:MaterialDateDisplay.DisplayDate>
                          <MultiBinding Mode="OneWay">
                            <MultiBinding.Converter>
                              <converters:CalendarDateCoalesceConverter />
                            </MultiBinding.Converter>
                            <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Calendar}}" Path="DisplayDate" />
                            <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Calendar}}" Path="SelectedDate" />
                          </MultiBinding>
                        </wpf:MaterialDateDisplay.DisplayDate>
                      </wpf:MaterialDateDisplay>
                    </Grid>
                  </ControlTemplate>
                </Grid.Resources>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto"/>
                  <RowDefinition Height="Auto"/>
                  <RowDefinition Height="Auto"/>
                  <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Border Grid.ColumnSpan="3" Grid.Row="0" Background="{DynamicResource PrimaryHueMidBrush}" />
                <Button x:Name="PART_HeaderButton"
                        Grid.Row="0"
                        Grid.ColumnSpan="3"
                        FontWeight="Bold" Focusable="False" FontSize="10.5"
                        HorizontalAlignment="Left" VerticalAlignment="Center"
                        Template="{StaticResource HeaderButtonTemplate}"
                        Height="Auto"
                        Margin="20 15"/>
                <Button x:Name="PART_PreviousButton" Grid.Row="1" Grid.Column="0" Focusable="False" HorizontalAlignment="Left" Height="36" Template="{StaticResource PreviousButtonTemplate}" Width="32"
                            Margin="6 0 0 0" Foreground="{TemplateBinding Foreground}" />
                <TextBlock x:Name="CurrentDateTextBlock"
                           HorizontalAlignment="Center" VerticalAlignment="Center"
                           Margin="8"
                           FontSize="14"
                           Grid.Row="1" Grid.Column="1"
                           FontWeight="SemiBold"
                           RenderTransformOrigin="0, 0.5"
                           Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}, Path=DisplayDate, StringFormat=MMMM yyyy}">
                  <TextBlock.RenderTransform>
                    <TranslateTransform X="0" Y="0"/>
                  </TextBlock.RenderTransform>
                </TextBlock>
                <Button x:Name="PART_NextButton" Grid.Row="1" Grid.Column="2" Focusable="False" HorizontalAlignment="Right" Height="36" Template="{StaticResource NextButtonTemplate}" Width="32"
                            Margin="0 0 6 0" Foreground="{TemplateBinding Foreground}" />

                <Grid x:Name="MonthViewWrapperGrid"
                      Grid.ColumnSpan="3"
                      Grid.Row="2"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Top"
                      Margin="6 -1 6 6"
                      Visibility="Visible">
                  <Border x:Name="PART_MonthViewCopy" RenderTransformOrigin="0, 0.5"
                          Opacity="0" Margin="4 7 4 3">
                    <Border.Background>
                      <VisualBrush Visual="{Binding ElementName=PART_MonthView}" Stretch="UniformToFill"/>
                    </Border.Background>
                    <Border.RenderTransform>
                      <TranslateTransform X="0"/>
                    </Border.RenderTransform>
                  </Border>
                  <Grid x:Name="PART_MonthView" RenderTransformOrigin="0, 0.5">
                    <Grid.RenderTransform>
                      <TranslateTransform X="0" />
                    </Grid.RenderTransform>
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="Auto"/>
                      <ColumnDefinition Width="Auto"/>
                      <ColumnDefinition Width="Auto"/>
                      <ColumnDefinition Width="Auto"/>
                      <ColumnDefinition Width="Auto"/>
                      <ColumnDefinition Width="Auto"/>
                      <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                      <RowDefinition Height="Auto"/>
                      <RowDefinition Height="Auto"/>
                      <RowDefinition Height="Auto"/>
                      <RowDefinition Height="Auto"/>
                      <RowDefinition Height="Auto"/>
                      <RowDefinition Height="Auto"/>
                      <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                  </Grid>
                </Grid>

                <Grid x:Name="YearViewWrapperGrid"
                      Grid.ColumnSpan="3"
                      Grid.Row="2"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Top"
                      Margin="6 -3 7 6"
                      Visibility="Hidden">
                  <Border x:Name="PART_YearViewCopy" RenderTransformOrigin="0, 0.5"
                          Opacity="0" Margin="2">
                    <Border.Background>
                      <VisualBrush Visual="{Binding ElementName=PART_YearView}" Stretch="UniformToFill"/>
                    </Border.Background>
                    <Border.RenderTransform>
                      <TranslateTransform X="0"/>
                    </Border.RenderTransform>
                  </Border>
                  <Grid x:Name="PART_YearView"
                               RenderTransformOrigin="0, 0.5">
                    <Grid.RenderTransform>
                      <TranslateTransform X="0" />
                    </Grid.RenderTransform>
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="Auto"/>
                      <ColumnDefinition Width="Auto"/>
                      <ColumnDefinition Width="Auto"/>
                      <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                      <RowDefinition Height="Auto"/>
                      <RowDefinition Height="Auto"/>
                      <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                  </Grid>
                </Grid>
              </Grid>
            </wpf:Card>
            <Rectangle x:Name="PART_DisabledVisual" Fill="{StaticResource DisabledColor}" Opacity="0" RadiusY="2" RadiusX="2" Stretch="Fill" Stroke="{StaticResource DisabledColor}" StrokeThickness="1" Visibility="Collapsed"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Visibility" TargetName="PART_DisabledVisual" Value="Visible"/>
            </Trigger>
            <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Year">
              <Setter Property="Visibility" TargetName="MonthViewWrapperGrid" Value="Hidden"/>
              <Setter Property="Visibility" TargetName="YearViewWrapperGrid" Value="Visible"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Decade">
              <Setter Property="Visibility" TargetName="MonthViewWrapperGrid" Value="Hidden"/>
              <Setter Property="Visibility" TargetName="YearViewWrapperGrid" Value="Visible"/>
            </DataTrigger>
            <EventTrigger RoutedEvent="Button.Click" SourceName="PART_NextButton">
              <BeginStoryboard>
                <Storyboard>
                  <DoubleAnimation Storyboard.TargetName="CurrentDateTextBlock"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   EasingFunction="{StaticResource EasingFunction}"
                                   AccelerationRatio="0.1" DecelerationRatio="0.89"
                                   From="240" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthViewCopy"
                                   Storyboard.TargetProperty="(UIElement.Opacity)"
                                   From="1" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthViewCopy"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="0" To="-270" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthView"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="270" To="0" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearViewCopy"
                                   Storyboard.TargetProperty="(UIElement.Opacity)"
                                   From="1" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearViewCopy"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="0" To="-240" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearView"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="240" To="0" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>
                </Storyboard>
              </BeginStoryboard>
            </EventTrigger>
            <EventTrigger RoutedEvent="Button.Click" SourceName="PART_PreviousButton">
              <BeginStoryboard>
                <Storyboard>
                  <DoubleAnimation Storyboard.TargetName="CurrentDateTextBlock"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   EasingFunction="{StaticResource EasingFunction}"
                                   AccelerationRatio="0.1" DecelerationRatio="0.89"
                                   From="-240" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthViewCopy"
                                   Storyboard.TargetProperty="(UIElement.Opacity)"
                                   From="1" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthViewCopy"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="0" To="270" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthView"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="-270" To="0" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearViewCopy"
                                   Storyboard.TargetProperty="(UIElement.Opacity)"
                                   From="1" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearViewCopy"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="0" To="240" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearView"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="-240" To="0" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>
                </Storyboard>
              </BeginStoryboard>
            </EventTrigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="MaterialDesignCalendarItemDueDate" TargetType="{x:Type CalendarItem}">
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="Margin" Value="0,0,-1,0"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type CalendarItem}">
          <ControlTemplate.Resources>
            <SineEase x:Key="EasingFunction" EasingMode="EaseOut"/>
            <CubicEase x:Key="EasingFunctionIn" EasingMode="EaseIn"/>

            <DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}">
              <TextBlock Foreground="{DynamicResource MaterialDesignBodyLight}"
                         Opacity="0.65"
                         FontWeight="Bold"
                         FontSize="9.5"
                         HorizontalAlignment="Center" VerticalAlignment="Center"
                         Margin="0,6,0,6"
                         Text="{Binding [0]}"/>
            </DataTemplate>
          </ControlTemplate.Resources>
          <Grid x:Name="PART_Root">
            <Grid.Resources>
              <SolidColorBrush x:Key="DisabledColor" Color="#A5FFFFFF"/>
            </Grid.Resources>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_DisabledVisual"/>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid Background="{TemplateBinding Background}">
              <Grid.Resources>
                <ControlTemplate x:Key="PreviousButtonTemplate" TargetType="{x:Type Button}">
                  <Grid Cursor="Hand">
                    <VisualStateManager.VisualStateGroups>
                      <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal"/>
                        <VisualState x:Name="MouseOver" />
                        <VisualState x:Name="Disabled">
                          <Storyboard>
                            <DoubleAnimation Duration="0" To=".56" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="path"/>
                          </Storyboard>
                        </VisualState>
                      </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <wpf:Ripple HorizontalAlignment="Center" VerticalAlignment="Center">
                      <Viewbox Height="12" Margin="8">
                        <Path x:Name="path" Data="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z" Fill="{TemplateBinding Foreground}" Stretch="Fill" />
                      </Viewbox>
                    </wpf:Ripple>
                  </Grid>
                </ControlTemplate>
                <ControlTemplate x:Key="NextButtonTemplate" TargetType="{x:Type Button}">
                  <Grid Cursor="Hand">
                    <VisualStateManager.VisualStateGroups>
                      <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal"/>
                        <VisualState x:Name="MouseOver"/>
                        <VisualState x:Name="Disabled">
                          <Storyboard>
                            <DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="path"/>
                          </Storyboard>
                        </VisualState>
                      </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <wpf:Ripple HorizontalAlignment="Center" VerticalAlignment="Center">
                      <Viewbox Height="12" Margin="8">
                        <Path x:Name="path" Data="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" Fill="{TemplateBinding Foreground}" Stretch="Fill"  />
                      </Viewbox>
                    </wpf:Ripple>
                  </Grid>
                </ControlTemplate>
              </Grid.Resources>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
              </Grid.ColumnDefinitions>
              <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
              </Grid.RowDefinitions>
              <Button x:Name="PART_HeaderButton"
                      Visibility="Collapsed"
                      Grid.Row="0"
                      Grid.ColumnSpan="3"
                      FontWeight="Bold" Focusable="False" FontSize="10.5"
                      HorizontalAlignment="Left" VerticalAlignment="Center"
                      Height="Auto"
                      Margin="20 15"/>
              <Button x:Name="PART_PreviousButton" Grid.Row="1" Grid.Column="0" Focusable="False" HorizontalAlignment="Left" Height="36" Template="{StaticResource PreviousButtonTemplate}" Width="32"
                          Margin="6 0 0 0" Foreground="{TemplateBinding Foreground}" />
              <TextBlock x:Name="CurrentDateTextBlock"
                         HorizontalAlignment="Center" VerticalAlignment="Center"
                         Margin="8"
                         FontSize="14"
                         Grid.Row="1" Grid.Column="1"
                         FontWeight="SemiBold"
                         RenderTransformOrigin="0, 0.5"
                         Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}, Path=DisplayDate, StringFormat=MMMM yyyy}">
                <TextBlock.RenderTransform>
                  <TranslateTransform X="0" Y="0"/>
                </TextBlock.RenderTransform>
              </TextBlock>
              <Button x:Name="PART_NextButton" Grid.Row="1" Grid.Column="2" Focusable="False" HorizontalAlignment="Right" Height="36" Template="{StaticResource NextButtonTemplate}" Width="32"
                          Margin="0 0 6 0" Foreground="{TemplateBinding Foreground}" />

              <Grid x:Name="MonthViewWrapperGrid"
                    Grid.ColumnSpan="3"
                    Grid.Row="2"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Top"
                    Margin="6 -1 6 6"
                    Visibility="Visible">
                <Border x:Name="PART_MonthViewCopy" RenderTransformOrigin="0, 0.5"
                        Opacity="0" Margin="4 7 4 3">
                  <Border.Background>
                    <VisualBrush Visual="{Binding ElementName=PART_MonthView}" Stretch="UniformToFill"/>
                  </Border.Background>
                  <Border.RenderTransform>
                    <TranslateTransform X="0"/>
                  </Border.RenderTransform>
                </Border>
                <Grid x:Name="PART_MonthView" RenderTransformOrigin="0, 0.5">
                  <Grid.RenderTransform>
                    <TranslateTransform X="0" />
                  </Grid.RenderTransform>
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                  </Grid.RowDefinitions>
                </Grid>
              </Grid>

              <Grid x:Name="YearViewWrapperGrid"
                    Grid.ColumnSpan="3"
                    Grid.Row="2"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Top"
                    Margin="6 -3 7 6"
                    Visibility="Hidden">
                <Border x:Name="PART_YearViewCopy" RenderTransformOrigin="0, 0.5"
                        Opacity="0" Margin="2">
                  <Border.Background>
                    <VisualBrush Visual="{Binding ElementName=PART_YearView}" Stretch="UniformToFill"/>
                  </Border.Background>
                  <Border.RenderTransform>
                    <TranslateTransform X="0"/>
                  </Border.RenderTransform>
                </Border>
                <Grid x:Name="PART_YearView"
                             RenderTransformOrigin="0, 0.5">
                  <Grid.RenderTransform>
                    <TranslateTransform X="0" />
                  </Grid.RenderTransform>
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                  </Grid.RowDefinitions>
                </Grid>
              </Grid>
            </Grid>
            <Rectangle x:Name="PART_DisabledVisual" Fill="{StaticResource DisabledColor}" Opacity="0" RadiusY="2" RadiusX="2" Stretch="Fill" Stroke="{StaticResource DisabledColor}" StrokeThickness="1" Visibility="Collapsed"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Visibility" TargetName="PART_DisabledVisual" Value="Visible"/>
            </Trigger>
            <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Year">
              <Setter Property="Visibility" TargetName="MonthViewWrapperGrid" Value="Hidden"/>
              <Setter Property="Visibility" TargetName="YearViewWrapperGrid" Value="Visible"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Decade">
              <Setter Property="Visibility" TargetName="MonthViewWrapperGrid" Value="Hidden"/>
              <Setter Property="Visibility" TargetName="YearViewWrapperGrid" Value="Visible"/>
            </DataTrigger>
            <EventTrigger RoutedEvent="Button.Click" SourceName="PART_NextButton">
              <BeginStoryboard>
                <Storyboard>
                  <DoubleAnimation Storyboard.TargetName="CurrentDateTextBlock"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   EasingFunction="{StaticResource EasingFunction}"
                                   AccelerationRatio="0.1" DecelerationRatio="0.89"
                                   From="240" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthViewCopy"
                                   Storyboard.TargetProperty="(UIElement.Opacity)"
                                   From="1" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthViewCopy"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="0" To="-270" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthView"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="270" To="0" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearViewCopy"
                                   Storyboard.TargetProperty="(UIElement.Opacity)"
                                   From="1" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearViewCopy"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="0" To="-240" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearView"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="240" To="0" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>
                </Storyboard>
              </BeginStoryboard>
            </EventTrigger>
            <EventTrigger RoutedEvent="Button.Click" SourceName="PART_PreviousButton">
              <BeginStoryboard>
                <Storyboard>
                  <DoubleAnimation Storyboard.TargetName="CurrentDateTextBlock"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   EasingFunction="{StaticResource EasingFunction}"
                                   AccelerationRatio="0.1" DecelerationRatio="0.89"
                                   From="-240" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthViewCopy"
                                   Storyboard.TargetProperty="(UIElement.Opacity)"
                                   From="1" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthViewCopy"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="0" To="270" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_MonthView"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="-270" To="0" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearViewCopy"
                                   Storyboard.TargetProperty="(UIElement.Opacity)"
                                   From="1" To="0" Duration="0:0:0.450"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearViewCopy"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="0" To="240" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>

                  <DoubleAnimation Storyboard.TargetName="PART_YearView"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                                   From="-240" To="0" Duration="0:0:0.450"
                                   AccelerationRatio="0.3" DecelerationRatio="0.69"/>
                </Storyboard>
              </BeginStoryboard>
            </EventTrigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="MaterialDesignCalendarPortrait" TargetType="{x:Type Calendar}">
    <Setter Property="Foreground" Value="{DynamicResource MaterialDesignBody}"/>
    <Setter Property="Background" Value="{DynamicResource MaterialDesignPaper}" />
    <Setter Property="CalendarDayButtonStyle" Value="{StaticResource MaterialDesignCalendarDayButton}" />
    <Setter Property="CalendarButtonStyle" Value="{StaticResource MaterialDesignCalendarButton}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Calendar}">
          <CalendarItem x:Name="PART_CalendarItem" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Style="{DynamicResource MaterialDesignCalendarItemPortrait}"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="MaterialDesignDueDateCalendar" BasedOn="{StaticResource MaterialDesignCalendarPortrait}" TargetType="{x:Type Calendar}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Calendar}">
          <CalendarItem x:Name="PART_CalendarItem" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Style="{DynamicResource MaterialDesignCalendarItemDueDate}"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="{x:Type Calendar}" BasedOn="{StaticResource MaterialDesignCalendarPortrait}" TargetType="{x:Type Calendar}" />

</ResourceDictionary>
